package vars;


import org.junit.Test

import com.mjawor.lpgroovy.vars.BooleanVar
import com.mjawor.lpgroovy.vars.FloatVar
import com.mjawor.lpgroovy.vars.IntVar

public class VarsTest {

	@Test
	public void testAsMathods() {
		assert new IntVar('x').getType() == Integer
		assert new FloatVar('x').getType() == Float
		assert new BooleanVar('x').getType() == Boolean
	}
	
	@Test
	public void testUpperAndLowerBounds() {
		def var = new FloatVar('x',1.0f).lb(5.7f).ub(6.8f)
		assert var.lb() == 5.7f
		assert var.ub() == 6.8f
		assert var.getValue() == 1.0f
		assert var.getType() == Float
		
		var = new IntVar('x',4).lb(2).ub(6)
		assert var.lb() == 2
		assert var.ub() == 6
		assert var.getValue() == 4
		assert var.getType() == Integer
		
		
		var = new BooleanVar('x',false)
		assert var.lb() == 0
		assert var.ub() == 1
		assert var.getType() == Boolean
	}
}
